package com.wsl.demo.user.entity;

import cn.org.atool.fluent.mybatis.annotation.FluentMybatis;
import cn.org.atool.fluent.mybatis.annotation.LogicDelete;
import cn.org.atool.fluent.mybatis.annotation.TableField;
import cn.org.atool.fluent.mybatis.annotation.TableId;
import cn.org.atool.fluent.mybatis.annotation.Version;
import cn.org.atool.fluent.mybatis.base.IEntity;
import cn.org.atool.fluent.mybatis.base.RichEntity;
import cn.org.atool.fluent.mybatis.functions.TableSupplier;
import java.io.Serializable;
import java.lang.Boolean;
import java.lang.Class;
import java.lang.Integer;
import java.lang.Long;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * UserEntity: 数据映射实体定义
 *
 * @author Powered By Fluent Mybatis
 */
@SuppressWarnings({"unchecked"})
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@FluentMybatis(table = "user",schema = "demo")
public class UserEntity extends RichEntity {
  private static final long serialVersionUID = 1L;

  /**
   */
  @TableId(value = "id", auto = false)
  private Integer id;

  /**
   */
  @TableField("name")
  private String name;

  /**
   */
  @TableField("age")
  private Integer age;

  /**
   */

  @TableField(value = "create_time", insert="now()")
  private Date createTime;

  /**
   */
  @TableField(insert="now()", update="now()",value = "update_time")
  private Date updateTime;

  /**
   */
  @TableField(value = "del_flag",insert = "0")
  @LogicDelete
  private Boolean delFlag;

  /**
   */
  @TableField(value = "version", insert = "0", update = "`version` + 1")
  @Version
  private Long version;

  @Override
  public Serializable findPk() {
    return this.id;
  }

  @Override
  public final Class<? extends IEntity> entityClass() {
    return UserEntity.class;
  }

  @Override
  public final UserEntity changeTableBelongTo(TableSupplier supplier) {
    return super.changeTableBelongTo(supplier);
  }

  @Override
  public final UserEntity changeTableBelongTo(String table) {
    return super.changeTableBelongTo(table);
  }
}
